<!-- #include file ="db\DatabaseManager.inc" -->
<%
Dim action
action = Request.QueryString("action")
if action = "read" then
    call read()
elseif action = "create" then
    call create()
end if

Public Sub read()
    on Error resume next
    set rs=Server.CreateObject("ADODB.recordset")
    rs.Open "select * from product order by ID__c", conn
    json = "{total:100,root:["
    do until rs.EOF
        json = json & "{"
        for each x in rs.fields
            json = json & x.name & ":'" & x.value & "',"
        next
        json = Left(json, (Len(json)-1))
        rs.MoveNext
        json = json & "},"
    loop
    rs.close
    conn.close
    json = Left(json, (Len(json)-1))
    json = json + "]}"
    Response.write(json)
    if err.number<>0 then
        Response.write("err=" & err)
    end if
end Sub

Public Sub create()
    on Error resume next
    //conn.Execute "insert into product (ID__c, Name__c, Prefix, Desc) values (45, 'ds', 'hj', 'hjkj')"
    conn.Execute "update [product] set [Desc]='hjkj'"
    conn.close
    Response.write("{success:'true'}")
    if err.number<>0 then
        Response.write("err=" & err)
    end if
end Sub
%> 
